From 0111c4bb06de535316fa4546e265d90478f0b717 Mon Sep 17 00:00:00 2001 From: Anthony Liguori Date: Fri, 19 May 2006 17:31:28 +0100 Subject: [PATCH] Expose the exceptions thrown by xen.lowlevel.xc so they can be caught. Signed-off-by: Anthony Liguori --- tools/python/xen/lowlevel/xc/xc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 59eaa86f67..f90dc12d67 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -1172,7 +1172,7 @@ static int PyXc_init(XcObject *self, PyObject *args, PyObject *kwds) { if ((self->xc_handle = xc_interface_open()) == -1) { - PyErr_SetFromErrno(PyExc_RuntimeError); + PyErr_SetFromErrno(xc_error); return -1; } @@ -1245,7 +1245,7 @@ PyMODINIT_FUNC initxc(void) if (m == NULL) return; - xc_error = PyErr_NewException(PKG ".error", NULL, NULL); + xc_error = PyErr_NewException(PKG ".Error", PyExc_RuntimeError, NULL); zero = PyInt_FromLong(0); /* KAF: This ensures that we get debug output in a timely manner. */ @@ -1254,6 +1254,9 @@ PyMODINIT_FUNC initxc(void) Py_INCREF(&PyXcType); PyModule_AddObject(m, CLS, (PyObject *)&PyXcType); + + Py_INCREF(xc_error); + PyModule_AddObject(m, "Error", xc_error); } -- 2.30.2